<?php
class ProductCacheService
{
	public function __construct()
	{
		$this->dao			= new ProductCacheDao();
	}
	
	public function getGroupList()
	{
		$condition['fields'] 	= 'updated,count(*) as num';
		$condition['groupby'] 	= 'updated';
		$condition['orderby'] 	= 'updated DESC';
		$tmp 					= $this->dao->fetchRows($condition);
		
		return $tmp;
	}
	
	public function getList($d,$start,$num)
	{
		$condition['where']['expression']		= 'updated=:updated';
		$condition['where']['value']['updated']	= $d;
		$condition['limit'] 					= $num;
		$condition['offset'] 					= $start;
		$result 								= $this->dao->fetchRows($condition);
		
		return $result;
	}
	
	public function deleteList($list)
	{
		if(empty($list))
		{
			return true;
		}
		$ids	= array();
		foreach($list as $lv)
		{
			$ids[]	= "'".$lv['id']."'";
		}
		$ids	= implode(',',$ids);
		$condition['expression']		= 'id in('.$ids.')';
		return $this->dao->deleteRows($condition);
	}
}
?>